home *** CD-ROM | disk | FTP | other *** search
/ Libris Britannia 4 / science library(b).zip / science library(b) / DJGPP / CBGRX103.ZIP / contrib / libgrx / src / p8pixrow.c < prev    next >
Text File  |  1993-12-06  |  2KB  |  75 lines

  1. /**
  2.  ** P8PIXROW.C
  3.  **
  4.  **  Copyright (C) 1992, Csaba Biegl
  5.  **    820 Stirrup Dr, Nashville, TN, 37221
  6.  **    csaba@vuse.vanderbilt.edu
  7.  **
  8.  **  This file is distributed under the terms listed in the document
  9.  **  "copying.cb", available from the author at the address above.
  10.  **  A copy of "copying.cb" should accompany this file; if not, a copy
  11.  **  should be available from where this file was obtained.  This file
  12.  **  may not be distributed without a verbatim copy of "copying.cb".
  13.  **  You should also have received a copy of the GNU General Public
  14.  **  License along with this program (it is in the file "copying");
  15.  **  if not, write to the Free Software Foundation, Inc., 675 Mass Ave,
  16.  **  Cambridge, MA 02139, USA.
  17.  **
  18.  **  This program is distributed in the hope that it will be useful,
  19.  **  but WITHOUT ANY WARRANTY; without even the implied warranty of
  20.  **  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  21.  **  GNU General Public License for more details.
  22.  **/
  23.  
  24. #include "p8.h"
  25. #include "memfill.h"
  26.  
  27. void _GrP8SetPixRow(long addr,int color,int width)
  28. {
  29.     int oper = C_OPER(color);
  30.     pixptr p;
  31.  
  32.     if(width <= 0) return;
  33.     if((_GrP8DrawTable[oper] ^ (color &= C_SIGNIF)) == 0) return;
  34.     _ClrDir();
  35.     if(CURC->gc_onscreen && _GrP8UsePlanarMode) {
  36.         if((oper == C_SET) && (width >= 32)) {
  37.         int rmask = ((int)addr + width) & 3;
  38.         int lmask = (int)addr & 3;
  39.  
  40.         PLANAR_MODE_ON();
  41.         p = P_XADDRESS(CURC,addr);
  42.         if(lmask) {
  43.             _SetVGAPlaneMask(_GrP8LmaskTable[lmask]);
  44.             *p++ = color;
  45.             width -= (4 - lmask);
  46.         }
  47.         width >>= 2;
  48.         _SetVGAPlaneMask(0xff);
  49.         _RowSetB(FASTROW,p,color,width);
  50.         if(rmask) {
  51.             _SetVGAPlaneMask(_GrP8RmaskTable[rmask]);
  52.             *(p + width) = color;
  53.         }
  54.         return;
  55.         }
  56.         PLANAR_MODE_OFF();
  57.     }
  58.     p = P_ADDRESS(CURC,addr);
  59.     if(((int)addr | width) & 1) switch(oper) {
  60.         case C_XOR: _RowSetXorB(XB,p,color,width); return;
  61.         case C_OR:  _RowSetOrB(OB,p,color,width);  return;
  62.         case C_AND: _RowSetAndB(AB,p,color,width); return;
  63.         default:    _RowSetB(WB,p,color,width);    return;
  64.     }
  65.     width >>= 1;
  66.     color |= (color << 8);
  67.     switch(oper) {
  68.         case C_XOR: _RowSetXorW(XW,p,color,width); return;
  69.         case C_OR:  _RowSetOrW(OW,p,color,width);  return;
  70.         case C_AND: _RowSetAndW(AW,p,color,width); return;
  71.         default:    _RowSetW(WW,p,color,width);    return;
  72.     }
  73. }
  74.  
  75.